/*
 * This file is Copyright 2002-2006 Loyola University Chicago,
 * Department of Computer Science and the Emerging Technologies Laboratory.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License via
 *    http://www.apache.org/licenses/LICENSE-2.0.
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.citep.business.sessions;

import java.util.List;
import java.util.Set;
import java.util.Date;
import java.math.BigDecimal;
import com.citep.business.*;

public interface AccountSession {
	public Account getAccount(int id);
	
	public Account createAccount(Account account) throws ValidationException;
	public Account createAccount(String name, String description, AccountTypes type, BigDecimal balance, Date startPeriod, Date endPeriod, boolean enabled, AccountCategory category) throws ValidationException;
	public Account createAccount(String name, String description, AccountTypes type, BigDecimal balance, Date startPeriod, Date endPeriod, boolean enabled, AccountCategory category, Account parent) throws ValidationException;

	public void updateAccount(Account account) throws ValidationException;
	
	public void deleteAccount(int id);
	public void deleteAccount(Account account);
	
	public void enableAccount(int id);
	public void disableAccount(int id);
	
	public List<Account>getAccounts(int offset, int limit);
	public List<Account>getAccounts(String name);
	//public List<Account>getTopLevelAccounts();
	public Account getAccountTree(int accountId);
	public Account getRoot();//returns the root account for all the hierarchy

	//returns the last time the chart of accounts was modified
	public Date getAccountTreeLastModified();
	
	public AccountCategory getAccountCategory(int id);
	
	public AccountCategory createAccountCategory(AccountCategory category) throws ValidationException;
	public AccountCategory createAccountCategory(String name, String descrption) throws ValidationException;
	
	public void updateAccountCategory(AccountCategory category) throws ValidationException;
	
	public void deleteAccountCategory(int id);
	public void deleteAccountCategory(AccountCategory category);
	
	public void enableAccountCategory(int id);
	public void disableAccountCategory(int id);
	
	public List<AccountCategory> getAccountCategories();
	public Set<Account> getAccountCategoryAssociatedAccounts(AccountCategory category);
	
	public AccountCategory getAccountCategory(String name);
	
	public void flush();
	
}